﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DemoView"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:IsConveter="using:IsConveter"
    x:Class="DemoView.MainPage"
    mc:Ignorable="d">

    <Page.Resources>
        <IsConveter:IsTrueConverter x:Key="BoolToNullConverter" IsValue="{x:Null}" />
        <IsConveter:IsTrueConverter x:Key="BoolToCheckStateStringConverter" IsValue="チェック状態" NotValue="非チェック状態" />
        <IsConveter:IsTrueConverter x:Key="BoolReverseConverter" />
        <IsConveter:IsNullConverter x:Key="NullToStringConverter" IsValue="ヌル" NotValue="ノットヌル" />
        <IsConveter:IsNullConverter x:Key="NullToBoolConverter" />
    </Page.Resources>

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="181*"/>
            <ColumnDefinition Width="224*"/>
            <ColumnDefinition Width="248*"/>
            <ColumnDefinition Width="713*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Vertical" Visibility="Collapsed" >
            <CheckBox x:Name="BoolData" Content="IsTrueConverterDemo" HorizontalAlignment="Left" VerticalAlignment="Top"/>
            <TextBlock HorizontalAlignment="Left" Margin="30,0,0,0" TextWrapping="Wrap" Text="{Binding IsChecked, Converter={StaticResource BoolToCheckStateStringConverter}, ElementName=BoolData}" VerticalAlignment="Top"/>
            <CheckBox IsChecked="{Binding IsChecked, Converter={StaticResource BoolReverseConverter}, ElementName=BoolData}" Content="Reverse" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Grid.Column="1">
            <CheckBox x:Name="NullData" Content="IsNullConverterDemo" HorizontalAlignment="Left" VerticalAlignment="Top" Tag="{Binding IsChecked, Converter={StaticResource BoolToNullConverter}, RelativeSource={RelativeSource Mode=Self}}"/>
            <TextBlock HorizontalAlignment="Left" Margin="30,0,0,0" TextWrapping="Wrap" Text="{Binding Tag, Converter={StaticResource NullToStringConverter}, ElementName=NullData}" VerticalAlignment="Top"/>
            <CheckBox IsChecked="{Binding Tag, Converter={StaticResource NullToBoolConverter}, ElementName=NullData, Mode=TwoWay}" Content="NullToBool" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Grid.Column="2" Visibility="Collapsed">
            <CheckBox x:Name="SequenceData" Content="IsNullConverterDemo" HorizontalAlignment="Left" VerticalAlignment="Top" Tag="{Binding IsChecked, Converter={StaticResource BoolToNullConverter}, RelativeSource={RelativeSource Mode=Self}}"/>
            <TextBlock HorizontalAlignment="Left" Margin="30,0,0,0" TextWrapping="Wrap" Text="{Binding IsChecked, Converter={StaticResource BoolToCheckStateStringConverter}, ElementName=BoolData}" VerticalAlignment="Top"/>
            <CheckBox IsChecked="{Binding Tag, Converter={StaticResource NullToBoolConverter}, ElementName=NullData, Mode=TwoWay}" Content="NullToBool" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        </StackPanel>
    </Grid>
</Page>
